<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Ingest node | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'ingest.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/ingest.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/ingest.html" rel="nofollow" target="_blank">../en/ingest.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-node">Ingest node</span>
</div>
<div class="navheader">
<span class="prev">
<a href="index-modules-index-sorting-conjunctions.html">« Use index sorting to speed up conjunctions</a>
</span>
<span class="next">
<a href="pipeline.html">Pipeline Definition »</a>
</span>
</div>
<div class="part">
<div class="titlepage"><div><div>
<h1 class="title">
<a id="ingest"></a>Ingest node<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/ingest.asciidoc">edit</a>
</h1>
</div></div></div>
<div class="openblock partintro">
<div class="content">
<p>Use an ingest node to pre-process documents before the actual document indexing happens.
The ingest node intercepts bulk and index requests, it applies transformations, and it then
passes the documents back to the index or bulk APIs.</p>
<p>All nodes enable ingest by default, so any node can handle ingest tasks. You can also create
dedicated ingest nodes. To disable ingest for a node, configure the following setting in the
elasticsearch.yml file:</p>
<div class="pre_wrapper lang-yaml">
<pre class="programlisting prettyprint lang-yaml">node.ingest: false</pre>
</div>
<p>To pre-process documents before indexing, <a class="xref" href="pipeline.html" title="Pipeline Definition">define a pipeline</a> that specifies a series of
<a class="xref" href="ingest-processors.html" title="Processors">processors</a>. Each processor transforms the document in some specific way. For example, a
pipeline might have one processor that removes a field from the document, followed by
another processor that renames a field. The <a class="xref" href="cluster-state.html" title="Cluster state API">cluster state</a> then stores
the configured pipelines.</p>
<p>To use a pipeline, simply specify the <code class="literal">pipeline</code> parameter on an index or bulk request. This
way, the ingest node knows which pipeline to use.</p>
<p>For example:
Create a pipeline</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT _ingest/pipeline/my_pipeline_id
{
  "description" : "describe pipeline",
  "processors" : [
    {
      "set" : {
        "field": "foo",
        "value": "new"
      }
    }
  ]
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1052.console"></div>
<p>Index with defined pipeline</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT my-index/_doc/my-id?pipeline=my_pipeline_id
{
  "foo": "bar"
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1053.console"></div>
<p>Response：</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "_index" : "my-index",
  "_type" : "_doc",
  "_id" : "my-id",
  "_version" : 1,
  "result" : "created",
  "_shards" : {
    "total" : 2,
    "successful" : 2,
    "failed" : 0
  },
  "_seq_no" : 0,
  "_primary_term" : 1
}</pre>
</div>
<p>An index may also declare a <a class="xref" href="index-modules.html#dynamic-index-settings" title="Dynamic index settings">default pipeline</a> that will be used in the
absence of the <code class="literal">pipeline</code> parameter.</p>
<p>Finally, an index may also declare a <a class="xref" href="index-modules.html#dynamic-index-settings" title="Dynamic index settings">final pipeline</a>
that will be executed after any request or default pipeline (if any).</p>
<p>See <a class="xref" href="ingest-apis.html" title="Ingest APIs">Ingest APIs</a> for more information about creating, adding, and deleting pipelines.</p>
</div>
</div>






</div>
<div class="navfooter">
<span class="prev">
<a href="index-modules-index-sorting-conjunctions.html">« Use index sorting to speed up conjunctions</a>
</span>
<span class="next">
<a href="pipeline.html">Pipeline Definition »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>